const Sequelize = require('sequelize');
module.exports = function(sequelize, DataTypes) {
  return sequelize.define('sp_manager', {
    mg_id: {
      autoIncrement: true,
      type: DataTypes.INTEGER,
      allowNull: false,
      primaryKey: true,
      comment: "主键id"
    },
    mg_name: {
      type: DataTypes.STRING(32),
      allowNull: false,
      comment: "名称"
    },
    mg_pwd: {
      type: DataTypes.CHAR(64),
      allowNull: false,
      comment: "密码"
    },
    mg_time: {
      type: DataTypes.INTEGER.UNSIGNED,
      allowNull: false,
      comment: "注册时间"
    },
    role_id: {
      type: DataTypes.TINYINT,
      allowNull: false,
      defaultValue: 0,
      comment: "角色id"
    },
    mg_mobile: {
      type: DataTypes.STRING(32),
      allowNull: true
    },
    mg_email: {
      type: DataTypes.STRING(64),
      allowNull: true
    },
    mg_state: {
      type: DataTypes.TINYINT,
      allowNull: true,
      defaultValue: 1,
      comment: "1：表示启用 0:表示禁用"
    }
  }, {
    sequelize,
    tableName: 'sp_manager',
    timestamps: false,
    indexes: [
      {
        name: "PRIMARY",
        unique: true,
        using: "BTREE",
        fields: [
          { name: "mg_id" },
        ]
      },
    ]
  });
};
